﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Emoney.Spider.Basic
{
    public class LogFile
    {
        public void WriteLog(string _msg)
        {
            lock (this)
            {
                try
                {
                    string Log_Name = DateTime.Now.ToString("yyyyMMdd") + ".log";
                    string Log_Path = System.Configuration.ConfigurationSettings.AppSettings["LogPath"].ToString();
                    string Log_FullName = Log_Path + Log_Name;
                    StreamWriter sw = new StreamWriter(Log_FullName, true, Encoding.GetEncoding("Gb2312"));
                    sw.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "  " + _msg);
                    sw.Close();
                }
                catch
                { }
            }
        }
    }
}
